<!--  -->
<template>
<div class='mycreate-music'>
    <div class="div1">
      <div class="header-logo">
      <img
        src="https://y.gtimg.cn/mediastyle/yqq/img/logo@2x.png?nowebp=1"
        alt=""
      />
    </div>
    <div class="header-nav">
      <li >
        <a href="javascript:;" >音乐馆</a>
      </li>
      <li style="background: #31c27c"><a href="javascript:;" style="color: #fff">我的音乐</a></li>
    </div>
    <div class="header-input">
      <input type="text" placeholder="搜索音乐、MV、歌单、用户" />
      <button>
        <i></i>
      </button>
    </div>
    <div class="header-login">
      <a :class="[{ show: show }]" @click="handleLogin()">登录</a>
      <a class="showuser" :class="[{ show: !show }]"
        >{{ item }},你好!
        <p class="loginout" @click="handleLoginOut()">退出登录</p>
      </a>
    </div>
    </div>
    <div class="portal-music-header">
      <div class="portal-music-header-inner">
        <div class="portal-music-header-link">
          <span class="portal-music-header-image"></span>
        </div>
        <h1>
          <span class="portal-music-header-name">XXX</span>
          <a href="#"
            ><img
              src="https://y.gtimg.cn/music/icon/v1/mac/svip_g@2x.png?max_age=2592000"
              alt=""
              class="lv"
          /></a>
        </h1>
      </div>
    </div>
    <div class="portal-music-main">
      <div class="portal-music-main-nav">
        <a href="#" class="portal-music-main-navlike" @click="handleClick()">我喜欢</a>
        <a href="#" class="portal-music-main-navlike " @click="handleClick1()">我的已购</a>
        <a href="#" class="portal-music-main-navlike active">我创建的歌单</a>
        <a href="#" class="portal-music-main-navlike">我上传的视频</a>
      </div>
      <div class="portal-music-main-box">
          <div class="portal-music-main-box-toolbar">
              <button class="portal-music-main-box-toolbar-btn" @click="handleClick2()">
                  <i class="portal-music-main-box-toolbar-btn-icon"></i>
                  新建歌单
              </button>
          </div>
          <div class="portal-music-main-box-list">
              <ul class="portal-music-main-box-list-header">
                  <li class="portal-music-main-box-list-header-name">歌单</li>
              </ul>
              <div class="portal-music-main-box-list-playlist">
                  <div class="portal-music-main-box-list-playlist-item" v-for="(item,index) in songlist" :key="item.id">
                      <div class="portal-music-main-box-list-playlist-item-cover">
                          <a href="#"><img :src="item.img" alt="" class="pic"></a>
                      </div>
                      <h4 class="portal-music-main-box-list-playlist-item-title">
                          <span class="portal-music-main-box-list-playlist-item-title-txt">
                              <a href="#" @click="handleClickto()">{{item.text}}</a>
                          </span>
                      </h4>
                      <a href="#" class="portal-music-main-box-list-playlist-item-del" @click="handleDelete(index)"></a>
                  </div>
              </div>
          </div>
      </div>
    </div>
    <div :class="[{'dialog':true},{hidden:boo}]">
      <div class="dialog_hd">
        <h2 class="dialog_hd_tit">创建新歌单</h2>
        <a href="#" class="dialog_hd_close">
          <i class="dialog_hd_close_icon" @click="handleClose()"></i>
        </a>
      </div>
      <div class="dialog_bd">
        <label for="" class="dialog_bd_label">歌单名</label>
        <div class="dialog_bd_txt">
          <input type="text" class="dialog_bd_txt_input" v-model="inputVal">
        </div>
      </div>
      <div class="dialog_ft">
        <button class="dialog_ft_btn" @click="handleSave()">确定</button>
      </div>
      
    </div>
    <div :class="[{'mask':true},{hidden:boo}]"></div>
</div>
</template>

<script>
//这里可以导入其他文件（比如：组件，工具js，第三方插件js，json文件，图片文件等等）
//例如：import 《组件名称》 from '《组件路径》';

export default {
//import引入的组件需要注入到对象中才能使用
components: {},
data() {
//这里存放数据
return {
  show: this.$store.state.status,
  item: localStorage.getItem("username"),
  boo:true,
  songlist:[
    {
      id:1,
      img:"https://y.gtimg.cn/mediastyle/global/img/cover_qzone.png?max_age=2592000",
      text:"QZone背景音乐"
    },
    {
      id:2,
      img:"https://y.gtimg.cn/mediastyle/global/img/cover_like.png?max_age=2592000",
      text:"我喜欢"
    },
  ],
  inputVal:"",
};
},
//监听属性 类似于data概念
computed: {},
//监控data中的数据变化
watch: {},
//方法集合
methods: {
  handleClick:function(){
    this.$router.push("portal");
  },
  handleClick1:function(){
    this.$router.push("buy");
  },
  handleClick2:function(){
    this.boo =false;
  },
  handleClose:function(){
    this.boo =true;
  },
  handleSave:function(){
    this.songlist.push({
      id:Date.now(),
      img:"https://y.gtimg.cn/mediastyle/global/img/cover_qzone.png?max_age=2592000",
      text:this.inputVal
    })
    this.boo =true
  },
  handleDelete:function(index){
    this.songlist.pop(index,1);
  },
  handleClickto:function(){
    this.$router.push("/");
  }
},
//生命周期 - 创建完成（可以访问当前this实例）
created() {

},
//生命周期 - 挂载完成（可以访问DOM元素）
mounted() {

},
beforeCreate() {}, //生命周期 - 创建之前
beforeMount() {}, //生命周期 - 挂载之前
beforeUpdate() {}, //生命周期 - 更新之前
updated() {}, //生命周期 - 更新之后
beforeDestroy() {}, //生命周期 - 销毁之前
destroyed() {}, //生命周期 - 销毁完成
activated() {}, //如果页面有keep-alive缓存功能，这个函数会触发
}
</script>
<style lang="less" scoped>
.mycreate-music {
  .div1 {
    cursor: pointer;
  width: 1200px;
  height: 90px;
  display: flex;
  margin: 0 auto;
  justify-content: space-between;
  border-bottom: 1px solid #ddd;
  .header-logo {
    margin-top: 22px;
    img {
      width: 170px;
      height: 46px;
    }
  }

  .header-nav {
    display: flex;
    margin-left: -50px;
    li {
      margin: 0 20px;
      list-style: none;
      width: 120px;
      height: 90px;
      line-height: 90px;
      text-align: center;
      font-size: 30px;
    }
    li:hover {
      a {
        color: #31c27c;
      }
    }
    a {
      list-style: none;
      color: #000;
      text-decoration: none;
    }
  }

  .header-input {
    height: 90px;
    vertical-align: auto;
    position: relative;
    line-height: 90px;
    input {
      padding: 0 10px;
      outline: none;
      width: 200px;
      height: 30px;
    }
    button {
      position: absolute;
      top: 30px;
      right: 0;
      border: 0 none;
      width: 38px;
      height: 35px;
      overflow: visible;
      background: 0 0;
    }
    i {
      background-image: url(https://y.gtimg.cn/mediastyle/yqq/img/icon_sprite.png?max_age=2592000&v=85678e8f28c7b4bcad5c209b21b7e3b3&v=85678e8f28c7b4bcad5c209b21b7e3b3);
      position: absolute;
      top: 50%;
      right: 11px;
      margin-top: -8px;
      width: 17px;
      height: 17px;
      background-position: 0 -40px;
    }
    i:hover {
      background-position: 0 -60px;
    }
  }

  .header-login {
    padding: 0 50px;
    height: 90px;
    vertical-align: auto;
    line-height: 90px;
    margin-left: -30px;
    position: relative;
    .show {
      display: none;
    }
    a {
      display: inline-block;
      height: 90px;
      color: #000;
      text-decoration: none;
      font-size: 20px;
    }
    a:hover {
      color: #31c27c;
    }
    .showuser {
      .loginout {
        position: absolute;
        background: #fff;
        height: 30px;
        width: 100%;
        color: #000;
        font-size: 16px;
        line-height: 30px;
        text-align: center;
        display: none;
        right: 0;
        top: 57px;
      }
    }
    .showuser:hover .loginout {
      display: block;
    }
  }
  }

  .portal-music-header {
    background: url(../assets/bg_profile.jpg) 50% no-repeat;
    background-size: cover;
    text-align: center;
    color: #fff;
    height: 315px;
    width: 100%;
    padding-top: 65px;
  }
  .portal-music-header-inner {
    height: 315px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
  }
  .portal-music-header-link {
    position: relative;
    width: 102px;
    height: 102px;
    margin: 0 auto;
  }
  .portal-music-header-image {
    display: block;
    width: 100%;
    height: 100%;
    border: 4px solid #fff;
    border-radius: 99px;
    background: #fff;
  }
  h1 {
    font-size: 0;
  }
  .portal-music-header-name {
    font-size: 30px;
    font-weight: 400;
    line-height: 64px;
    margin-right: 14px;
  }
  a {
    text-decoration: none;
  }
  .lv {
    vertical-align: -3px;
  }
  .portal-music-main {
    min-height: 500px;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
  }
  .portal-music-main-nav {
    position: absolute;
    top: -56px;
    left: 0;
    margin-bottom: 0;
    width: 80%;
    overflow: hidden;
    border-bottom: 0 none;
    height: 56px;
    line-height: 56px;
  }
  .portal-music-main-navlike:hover{
      color: #31c27c;
  }
  .active{
      color: #31c27c !important;
  }
  .portal-music-main-navlike {
    margin-right: 40px;
    position: relative;
    float: left;
    font-size: 16px;
    overflow: hidden;
    height: 56px;
    line-height: 56px;
    color: #fff;
  }
  .portal-music-main-box-toolbar{
      padding-top: 30px;
    height: 40px;
    margin-bottom: -34px;
  }
  .portal-music-main-box-toolbar-btn{
      border: 1px solid #c9c9c9;
    color: #000;
    border-radius: 2px;
    font-size: 14px;
    margin-right: 6px;
    padding: 0 23px;
    height: 38px;
    line-height: 38px;
    display: inline-block;
    white-space: nowrap;
    box-sizing: border-box;
    overflow: hidden;
  }
  .portal-music-main-box-toolbar-btn-icon{
      background: url(../assets/icon_sprite.png);
      width: 16px;
    height: 16px;
    background-position: 0 -180px;
    display: inline-block;
    margin-right: 6px;
    background-repeat: no-repeat;
    vertical-align: -3px;
  }
  .portal-music-main-box-list{
      padding-top: 50px;
      padding-bottom: 40px;
      font-size: 14px;
  }
  .portal-music-main-box-list-header{
      height: 50px;
    line-height: 50px;
    background-color: #fbfbfd;
    color: #999;
  }
  .portal-music-main-box-list-header-name{
      width: 60%;
      float: left;
    padding-left: 20px;
    list-style: none;
  }
  .portal-music-main-box-list-playlist-item{
      position: relative;
    height: 70px;
    line-height: 70px;
    zoom: 1;
    overflow: hidden;
    clear: both;
    font-size: 0;
  }
  .portal-music-main-box-list-playlist-item:hover .portal-music-main-box-list-playlist-item-del{
    visibility: visible;
  }
  .portal-music-main-box-list-playlist-item-cover{
      padding-left: 0;
      position: relative;
      float: left;
    width: 50px;
    height: 50px;
    overflow: hidden;
    margin-top: 10px;
  }
  .portal-music-main-box-list-playlist-item-cover a{
      display: block;
    height: 100%;
    position: relative;
  }
  .pic{
      height: 100%;
    object-fit: cover;
    display: block;
    width: 100%;
    min-height: 50px;
  }
  .portal-music-main-box-list-playlist-item-title{
      width: 60%;
    padding-left: 20px;
    font-weight: 400;
    text-indent: 15px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 14px;
    float: left;
    height: 70px;
  }
  .portal-music-main-box-list-playlist-item-title-txt{
      float: left;
    max-width: 90%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .portal-music-main-box-list-playlist-item-title-txt a:hover{
      color: #31c27c;
  }
  .portal-music-main-box-list-playlist-item-del{
    background: url(../assets/icon_list_menu.png);
    position: absolute;
    top: 50%;
    right: 9px;
    margin-top: -18px;
    width: 36px;
    height: 36px;
    background-position: 0 -160px;
    visibility: hidden;
  }
  .hidden{
    display: none;
  }
  .dialog{
    position: fixed;
    z-index: 100000;
    top: 460px;
    margin: 10px;
    width: 520px;
    height: auto;
    left: 700px;
    border: 1px solid #bfbfbf;
    box-shadow: 0 0 10px rgb(0 0 0 / 30%);
    background-color: #fff;
    font-size: 14px;
    color: #333;

  }
  .dialog_hd{
    position: relative;
    line-height: 55px;
    text-align: center;
    border-bottom: 1px solid #f2f2f2;
  }
  .dialog_hd_tit{
    font-size: 16px;
    font-weight: 400;
  }
  .mask{
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,.2);
    z-index: 999;
 
  }
  .dialog_hd_close{
    position: absolute;
    top: 6px;
    right: 6px;
    width: 24px;
    height: 24px;
    overflow: hidden;
    z-index: 2;
  }
  .dialog_hd_close_icon{
    background: url(../assets/icon_popup.png);
    display: block;
    margin: 6px auto;
    width: 12px;
    height: 12px;
    background-position: 0 -200px;
  }
  .dialog_bd{
    position: relative;
    margin-top: 39px;
    padding: 0 40px 0 101px;
    padding-bottom: 28px;
    overflow: hidden;
  }
  .dialog_bd_label{
    position: absolute;
    top: 0;
    left: 0;
    width: 81px;
    line-height: 40px;
    text-align: right;
  }
  .dialog_bd_txt{
    width: 377px;
    border-color: #e1e1e1;
    position: relative;
    display: block;
    height: 38px;
    background-color: #fff;
    border: 1px solid #c8cbcc;
  }
  .dialog_bd_txt_input{
    height: 38px;
    line-height: 38px;
    border: 0 none;
    margin-left: 11px;
    vertical-align: top;
    background: 0 0;
    width: 330px;
  }
  .dialog_ft{
    padding: 20px 20px 0 0;
    height: 60px;
    text-align: right;
  }
  .dialog_ft_btn{
    width: auto;
    min-width: 122px;
    text-align: center;
    margin: 0 3px;
    border: 1px solid #31c27c;
    background-color: #31c27c;
    color: #fff;
    border-radius: 2px;
    font-size: 14px;
    padding: 0 23px;
    height: 38px;
    line-height: 38px;
    display: inline-block;
    white-space: nowrap;
    box-sizing: border-box;
    overflow: hidden;
  }
}
</style>